package com.jy.rhin.infra.repo.document.content.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jy.rhin.domain.document.content.entity.DocumentContentDO;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author dhl
 */
@Data
@NoArgsConstructor
@TableName("t_document_content")
public class DocumentContentPO {

    public DocumentContentPO(DocumentContentDO content) {
        this.id = content.getId();
        this.uniqueId = content.getUniqueId();
        this.repositoryUniqueId = content.getRepositoryUniqueId();
        this.title = content.getTitle();
        this.hash = content.getHash();
        this.size = content.getSize();
        this.content = content.getContent();
        this.createTime = new Date();
    }

    @TableId
    private Long id;
    /**
     * 唯一标识符
     */
    @TableField("unique_id")
    private String uniqueId;
    /**
     * 存储文档的文档存储库唯一标识符
     */
    @TableField("repository_unique_id")
    private String repositoryUniqueId;
    /**
     * 文档标题
     */
    @TableField("title")
    private String title;
    /**
     * 文档哈希值
     */
    @TableField("hash")
    private String hash;
    /**
     * 文档内容长度
     */
    @TableField("size")
    private Integer size;
    /**
     * 文档内容
     */
    @TableField("content")
    private String content;
    /**
     * 创建时间
     */
    @TableField("create_time")
    private Date createTime;

}
